function First_page()
    print("---------------Data System------------------\n")
    print(" 1. Storage the data\n 2. read the data \n 3. see all the data \n 4. delete the data")
    print("\n------------------(Q A Q)--------------------")
    print("\n Please input a number to choose the function:")
end

function Empty()
    i = 1
    while (i <= 100) do
        if Name_input[i].len ~= nil then
            return 0
        end
        i = i + 1
    end
    if i == 100 then
        return 1
    end
end
function Storage_data()
    i = 0
    print("\n You are going to storage the data:")

    print(" Please input your name:")
    io.read("*l")
    repeat
        i = i + 1
    until Name_input[i].len == nil
    Name_input[i] = io.read("*l")
    print(" The name you stored is:")
    print(Name_input[i])

    while (1) do
        print(" Please input your age:")
        Age_input[i] = io.read("*n")
        if Age_input[i] <= 0 then
            print("You have already born! 你在玩我！")
        elseif Age_input[i] >= 120 then
            print("你可能是个老妖怪！")
        else
            break
        end
    end
    print(" The age you stored is:")
    print(Age_input[i])
    print("Store successfully!")
end

function Read_data()
    if Empty() == 0 then
        print("\n You are going to read the data you want:")
        print("Please input the name:")
        io.read("*l")
        exact_data = io.read("*l")
        i = 1
        k = 0
        while (i <= 100) do
            if Name_input[i] == exact_data then
                str = string.format(" %s's age is %d", Name_input[i], Age_input[i])
                print(str)
                k = 1
            end
            i = i + 1
        end
        if k == 0 then
            print("I'm sorry, I can't find the data you want!\n ")
        end
    else
        print("The file is empty! Please input data first!")
    end
end

function Delete_data()
    if Empty() == 0 then
        print("\n You are going to delete the data you hate:")
        print("Please input the name:")
        io.read("*l")
        exact_data = io.read("*l")
        i = 1
        k = 0
        while (i <= 100) do
            if Name_input[i] == exact_data then
                str = string.format(" %s's age is %d", Name_input[i], Age_input[i])
                print("The information you want to delete is:")
                print(str)
                Name_input[i] = {}
                Age_input[i] = 0
                k = 1
            end
            i = i + 1
        end
        if k == 0 then
            print("I'm sorry, I can't find the data you want to delete!\n ")
        end
    else
        print("The file is empty! Please input data first!")
    end
end

function See_data()
    if Empty() == 0 then
        i = 1
        print("\n You are going to see all the data:")
        while (i <= 100) do
            if Name_input[i].len ~= nil then
                str = string.format(" %s's age is %d", Name_input[i], Age_input[i])
                print(str)
            end
            i = i + 1
        end
        print("\n That's all the information")
    else
        print("The file is empty! Please input data first!")
    end
end

Age_input = {}
for i = 1, 100 do
    Age_input[i] = 0
end
Name_input = {}
for i = 1, 100 do
    Name_input[i] = {}
end
i = 0
while (1) do
    First_page()
    choice = io.read("*n")
    Empty()
    if (choice == 1) then
        Storage_data()
    elseif (choice == 2) then
        Read_data()
    elseif (choice == 3) then
        See_data()
    elseif (choice == 4) then
        Delete_data()
    else
        print("You put in the wrong choice! ")
    end
    print("You can choose 0 to exit or any number to continue")
    i = io.read("*n")
    if (i == 0) then
        os.exit()
    end
end
